package com.woniuxy.vuetest.controller;

import com.woniuxy.vuetest.entity.Cart;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

/**
 * @author linke
 * @version 1.0
 * @className: CartController
 * @description: 购物车控制器
 * @date 2021/11/18 22:09
 */
@RestController
@RequestMapping("/cart")
public class CartController {
    /**
     * 跨域解决方式一：
     *
     * @CrossOrigin 同意跨域请求
     *
     * 查询所有购物车数据
     * @return
     */
    //@CrossOrigin
    @RequestMapping("/all")
    public List<Cart> all(){
        return Arrays.asList(
                new Cart(1001,"精神现象学",null,12,32),
                new Cart(1002,"哲学史讲演录",null,12,42),
                new Cart(1003,"小逻辑",null,12,52)
        );
    }


}
